//
//  VDJConstant.h
//  Vdianjing
//
//  Created by appbegin on 15/7/18.
//  Copyright (c) 2015年 Vdianjing. All rights reserved.
//

//一，px和pt转换
//px:相对长度单位。像素（Pixel）。（Px字体）
//pt:绝对长度单位。 点（Point）。（iOS字体）
//公式如下：
//pt=(px/96)*72。


//----------------颜色-------------
#define kGetColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]

//页面背景颜色
#define kBackgroundColor    kGetColor(246, 246, 246)
//导航栏颜色
#define kNavBackgroundColor kGetColor(59, 113, 222)
// 导航栏字体颜色
#define kNavFontColor       [UIColor whiteColor]
//字体颜色黑色
#define kBlackFontColor     kGetColor(51, 51, 51)
//字体颜色灰色
#define kGrayFontColor      kGetColor(153, 153, 153)
//字体颜色红色
#define kRedFontColor       kGetColor(253, 93, 107)
//线颜色
#define kLineColor          kGetColor(229, 229, 229)
// 浅绿
#define kLightGreenColor    kGetColor(89, 195, 175)
// 浅黄
#define kLightYellowColor   kGetColor(255,184, 54)
// 透明
#define kClearClolor        [UIColor clearColor]
// 白色
#define kWhiteColor         [UIColor whiteColor]

// 圆角
#define kRadiusCorner 5
//左右间距
#define kMargin 12

//----------------控件比例-------------
#define kGetX(f)   CGRectGetMaxX(f)
#define kGetY(f)   CGRectGetMaxY(f)
//屏幕宽高
#define kScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds)
#define kScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds)

#define CurrentMode  [UIScreen instancesRespondToSelector:@selector(currentMode)]
#define iPhone4 (CurrentMode ? CGSizeEqualToSize(CGSizeMake(640, 960),  [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 (CurrentMode ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 (CurrentMode ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6p (CurrentMode ? CGSizeEqualToSize(CGSizeMake(1920, 1080),[[UIScreen mainScreen] currentMode].size) : NO)

//屏幕自动适配
#define GetWidth(width)   (iPhone4 || iPhone5 ? (width)  : ((width) *kScreenWidth/320)     )
#define GetHeight(height) (iPhone4 || iPhone5 ? (height) : ((height)*kScreenHeight/568)    )

//----------------系统版本-------------
//判定系统版本。
#define IOS7orLater ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0f) ? (YES):(NO)
#define IOS8orLater ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0f) ? (YES):(NO)
#define IOS9orLater ([[UIDevice currentDevice].systemVersion doubleValue] >= 9.0f) ? (YES):(NO)
//获取当前系统的版本 iOS...
#define kCurrentVersion [[[UIDevice currentDevice] systemVersion] floatValue]

// 获得当前Version
#define kVersionString [NSString stringWithFormat:@"%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]]
// 获得当前Build
#define kVersionKey [NSString stringWithFormat:@"%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]]


//自定义Log
#ifdef DEBUG
#define MyLog(...) NSLog(__VA_ARGS__)
#else
#define MyLog(...)
#endif

// 入口类
#define kAppdalegate (AppDelegate *)[UIApplication sharedApplication].delegate

//weak self
#define kWeakSelf __weak __typeof(self) weakSelf = self;

//----------------常用宏-------------
#define kGetImage(name, suffix) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(name) ofType:(suffix)]]
// 判断空字符串
#define strIsEmpty(str) ([(str) isKindOfClass:[NSNull class]] || (str) == nil || [(str) length]<1 ? YES : NO)
// 字符串比较
#define kStringAIsEqualToStringB(A, B) [A isEqualToString:B]
//系统字体
#define kFontWithSize(f)   [UIFont systemFontOfSize:(f)]


